<template>
	<view class="container">
		<web-view class="webview" :webview-styles="webviewStyles" :src="kfurl"></web-view>
		<view class="footer">超脑智算</view>
	</view>
</template>

<script>
    export default {
		data() {
			return {
				kfurl:'',
				username:'',
				webviewStyles: {
					progress: {
						color: '#FF3333'
					}
				}
			};
		},
		onLoad: function (option) {
			// console.log('客服页面onLoad：',option)
			this.loadData();
		},
		onNavigationBarButtonTap(val) {
			// console.log('客服页面onNavigationBarButtonTap：',val)
			uni.switchTab({
				url: '/pages/index/index',
			});	
		},
		methods: {
			loadData:function(){
				//获取基础参数
				var info = uni.getStorageSync("userinfo");
				if (info.token) {
					let timestamp = this.helper.now();
					let sign = this.helper.setSign(['token='+info.token,'key=service','timestamp='+timestamp]);
					this.helper.req({
						api:"getInfoSet",
						timestamp:timestamp,
						data:{token:info.token,
							key:'service'},
						header:{sign:sign},
						method:'GET',
					}).then(res=>{
						var urla = res.data.data[0].kfurl;
						//this.kfurl = res.data.data[0].kfurl;
						this.username =res.data.data[0].username;
						this.kfurl= urla+'?username='+this.username;
						//console.log('链接'+this.kfurl)
					})
				}
			},
		},
	};
</script>

<style>
.container {
    width: 100%;
    height: 100%;
}

.webview {
    width: 100%;
	/* #ifdef H5 */
    height: calc(100% - 50px); /* 预留底部35px */
	/* #endif */
}

.footer {
    position: absolute;
    bottom: 0;
    width: 100%;
    height: 40px;
    background-color: #f0f0f0; /* 你可以根据需要调整背景颜色 */
    display: flex;
    align-items: center;
    justify-content: center;
}
</style>